<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="renderer" content="webkit">
<title></title>
<link rel="stylesheet" href="{{ asset('admin_style/css/pintuer.css') }}">
   <link rel="stylesheet" href="{{ asset('admin_style/css/admin.css') }}">
   <link rel="stylesheet" href="{{ asset('home_style/css/html.css') }}">
    <script src="{{asset('admin_style/js/jquery.js')}}"></script>
    <script src="{{asset('admin_style/js/pintuer.js')}}"></script>
</head>
<style>
    .col{color:red}
</style>
<body>
<div class="panel admin-panel margin-top" style="height:700px">
  <div class="panel-head" id="add"><strong><span class="icon-pencil-square-o"></span> 收货地址管理</strong></div>
  <div class="body-content" style="margin-left:50px">
      <div class="form-group">
        <div class="field">
          <label><input class="button bg-green" type="button" value="添加新地址" id="button"></label>
	  <div class="form-group" id="setAddress" style='display:none'>
              <div id="address_wrap">
               <div class="addr_right topay" isaddress="true">
		<div class="addr_edit" id="J_s_addr_edit">
			<div class="addressbox_warp">
				<div class="addressbox" id="J_sAddrWrap"></div> 
					<div class="address_wrapper">
						<div class="__addressPop"> 
							<dl class="address_pop"> 
								<input class="J_addressid" name="addressId" value="" type="hidden"> 
								<input class="J_isdefault" name="addressId" value="false" type="hidden">
								<dt >省：</dt>
								<dd class="pt_ie6hack" style='padding-top:0px'> 
									<i class="needicon">*</i>
									<select name="province" id="home_address-sprovince" class="J_province J_select w140 vm"> 
										<option value="-1" class="change_city">请选择</option>
					                                        @foreach($data as $k=>$v)
										<option value="{{ $v->t_g_id}}" class="change_city">{{$v->t_city}}</option>
						                               @endforeach												
									</select> 
									<label class="dt" for="">市：</label> 
									<select name="city" id="home_address-scity" class="J_city J_select w100 vm">
										<option value="0" class='change_district'>请选择</option>
									</select> 
										<label class="dt" for="">区：</label> 
									<select name="area" id="home_address-sarea" class="J_area J_select w100 vm">
										<option value="0">请选择</option>
									</select> 
										<span class="prompt city_select"></span> 
								</dd> 
								<dt>邮政编码：</dt>
								<dd> 
									<i class="needicon">*</i> 
									<input data-type="c" data-errormsg="请填写正确的邮政编码" data-normal="" class="text formsize_normal J_postcode J_form vm" name="postcode" value="" type="text"> 
									<span class="prompt mail_select"></span> 
								</dd> 
								<dt>街道地址：</dt> 
								<dd>
									<i class="needicon">*</i> 
									<textarea data-type="*" data-min="5" data-max="100" data-normal="请填写街道地址，最少5个字，最多不能超过100个字" data-errormsg="请填写街道地址，最少5个字，最多不能超过100个字" class="textarea formsize_large J_street J_form" name="street" cols="30" rows="3"></textarea>
									<span class="prompt breakline">请填写街道地址，最少5个字，最多不能超过100个字</span> 
								</dd> 
								<dt>收货人姓名：</dt> 
								<dd> 
									<i class="needicon">*</i> 
									<input data-type="*" data-errormsg="请填写收货人" data-normal="" class="text formsize_normal J_name J_form vm" name="name" value="" type="text">
									<span class="prompt name_select"></span> 
								</dd> 
								<dt>手机：</dt> 
								<dd> 
									<i class="needicon">*</i> 
									<input data-type="phone" data-errormsg="请填写正确的联系号码" data-normal="" class="text formsize_normal J_mobile J_form vm" name="mobile" value="" type="text">
									<span class="prompt mobile_select"></span> 
								</dd> 
								<dt></dt>
								<dd class="pt10 oper_btn"> 
									<a href="javascript:;" class="confirm_btn J_okbtn mr10">确认地址</a> 
									<a href="javascript:;" class="cancel_btn J_cancelbtn">取消</a> 
								</dd> 
							</dl>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div></div>
	 </div>
        </div>
     </div>
  </div>
</div>
</div>
</body>
</html>
<script>
    $("#button").on('click',getAddress);
    function getAddress(){
    $("#setAddress").toggle();
 }

   $(".change_city").on("click",select_address);
function select_address(event){
	var change_value=$(this).attr('value');
    $.ajax({
        url:"{{url('home/selectd_address')}}",
         type:"get",
         data:{
                "r_id":change_value,
              },
         dataType:"json",
        success:function(res){
                if(res['success']){
                  $("#home_address-scity").empty();
                   for(i=0;i<res['data'].length;i++){
                   $("#home_address-scity").append("<option value ='"+res['data'][i]['t_g_id']+"'>"+res['data'][i]['t_city']+"</option>");
                  }
                }
        }
 });

};

</script>
